#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include "getputch.h"

int main(void)
{
    char* goal = "How do you do?";
    int len = strlen(goal);

    time_t s,e;

    time(&s);

    init_getputch();

    puts("请照着输入.");
    fflush(stdout);

    int i=0;
    for (;i<len; ++i) {
        printf("%s \r", &goal[i]);
        fflush(stdout);

        while (getch() != goal[i])
            ;
    }

    time(&e);

    printf("用时%.1fs!\n", (double)e - s);
    fflush(stdout);

    getch();

    term_getputch();

    return 0;
}
